package com.bringway.p2p.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.bringway.framework.controller.JsonController;
import com.bringway.framework.util.RequestUtils;
import com.bringway.p2p.service.POSUserInfoService;

import net.sf.json.JSONObject;
@Controller
@RequestMapping("/posUserInfo")
public class POSUserInfoController extends JsonController{
	
	@Autowired
	private POSUserInfoService posUserInfoService;
	@RequestMapping("/query")
	public ModelAndView queryPOSUserInfo(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject params = new JSONObject();
		JSONObject result = new JSONObject();
		
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String posCode = RequestUtils.getStringParameter(request, "POS_CODE");
		String posOwnerSjhm = RequestUtils.getStringParameter(request, "POS_OWNER_SJHM");
		String startDate = RequestUtils.getStringParameter(request, "START_DATE");
		String endDate = RequestUtils.getStringParameter(request, "END_DATE");
		params.put("START_DATE", startDate);
		params.put("END_DATE", endDate);
		params.put("start", start);
		params.put("limit", limit);
		params.put("POS_CODE", posCode);
		params.put("POS_OWNER_SJHM", posOwnerSjhm);
		List<Map<String, Object>> list = posUserInfoService.queryPOSUserInfoList(params);
		int total = posUserInfoService.getPOSUserInfoCount(params);
		result.put("data", list);
		result.put("total", total);
		serialize(request, response, result);
		return null;
	}
}
